<?php

namespace Home\Controller;

use Think\Controller;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/12
 * Time: 16:13
 */
class CommnController extends Controller
{
    public function __construct()
    {
        parent::__construct();
        if (empty($_SESSION['id'])) {
            $this->redirect('Login/login');
        }
        $this->m_username = $_SESSION['name'];
        $this->m_mobile = $_SESSION['phone'];
        $this->m_str = $_SESSION['login_time'];
        $this->m_id = $_SESSION['id'];
    }

    public function ajax($code, $result, $r = '')
    {
        if (empty($r)) {
            $this->ajaxReturn(['code' => $code, 'result' => $result]);
        } else {
            $this->ajaxReturn(['code' => $code, 'result' => $result]);
            return false;
        }
    }


}